<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>药品管理-添加</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/back/css/x-admin.css"
	media="all">

<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
	$(function() {

		$("#addMedical")
				.click(
						function() {
							$
									.ajax({
										url : "${pageContext.request.contextPath}/addMedicine",
										type : "post", //增加操作  post方法
										contentType : "application/json",
										data : JSON.stringify({
											medicinename : $("#medicinename")
													.val(),
											medicinetype : $("#medicinetype")
													.val(),
											medicinenum : $("#medicinenum")
													.val(),
											medicineprice : $("#medicineprice")
													.val(),
										}),
										
										success : function(result) {
											if (result == "success") {
												location.href = "${pageContext.request.contextPath}/medicine"
											}
										}
									});

						});
	});
</script>
</head>

<body>
	<div class="x-body">
		<form class="layui-form">


			<div class="layui-form-item">
				<label for="L_email" class="layui-form-label"> <span
					class="x-red">*</span>药品名称
				</label>
				<div class="layui-input-inline">
					<input type="text" name="medicinename" id="medicinename"
						class="layui-input">
				</div>
				<div class="layui-form-mid layui-word-aux">
					<span class="x-red">*</span>必填
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label"> <span class="x-red">*</span>药品种类
				</label>
				<div class="layui-input-inline">
					<input type="text" name="medicinetype" id="medicinetype"
						class="layui-input">
					<!-- <select name="medicinetype" id="medicinetype" class="layui-input" >
							<option value="ganmao">感冒药</option>
							<option value="fashao">发烧药</option>
							<option value="weiyao">胃药</option>
							<option value="xiaoyan">消炎药</option>
						</select> -->
				</div>
				<div class="layui-form-mid layui-word-aux">
					<span class="x-red">*</span>必填
				</div>
			</div>
			<div class="layui-form-item">
				<label for="L_repass" class="layui-form-label"> <span
					class="x-red">*</span>库存数量
				</label>
				<div class="layui-input-inline">
					<input type="text" name="medicinenum" id="medicinenum"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label for="L_username" class="layui-form-label"> <span
					class="x-red">*</span>药品单价
				</label>
				<div class="layui-input-inline">
					<input type="text" name="medicineprice" id="medicineprice"
						class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label for="L_repass" class="layui-form-label"> </label>
				<button class="layui-btn" id="addMedical">增加</button>
			</div>
		</form>
	</div>
	<script
		src="${pageContext.request.contextPath}/back/lib/layui/layui.js"
		charset="utf-8">
		
	</script>
	<script src="${pageContext.request.contextPath}/back/js/x-layui.js"
		charset="utf-8">
		
	</script>
</body>

</html>